from api.apps.login import login_app
from api.apps.login.login_function import EmailSender , Sample
from flask import request

@login_app.route('/login', methods=['POST'])
def login_page():
    json_data = request.get_json(force=True)
    account_type = json_data.get('type')
    value = json_data.get('value')
    print(account_type, value)

    if account_type == 'email':
        sender = EmailSender()
        mail_code = sender.send_verification_code(value)
        return mail_code
    else:
        number_code = Sample.main(['arg1', 'arg2'], value)
        return number_code



